@import "variables";
@import "mixins";
@import "layout";

#front-content {
  @include clearfix;
  overflow: visible;

  #front-navigation {
    float: left;
    width: 618px;
    margin-bottom: 24px;
    border-right: solid 1px $base-border-color;
  }
}

#front-nav {
  @include clearfix;

  ul {
    @extend .unstyled !optional;
    padding-top: 24px;

    li {
      display: block;
      float: left;
      width: 280px;
      margin-bottom: 20px;

      &#nav-about,
      &#nav-downloads {
        margin-right: 30px;
      }

      &#nav-about,
      &#nav-documentation {
        margin-bottom: 40px;
      }
    }
  }

  a {
    display: block;
    height: 86px;
    padding-left: 90px;
    color: $font-color;
    background-repeat: no-repeat;
    background-position: 0 0;
    transition-duration: 0.3s;
    transition-property: color;

    img {
      float: left;
      margin-right: -90px;
      margin-left: -90px;
      opacity: 0.9;
      transition-duration: 0.3s;
      transition-property: opacity;
    }

    h3 {
      font-size: 18px;
      font-weight: bold;
      color: $orange;
    }

    p {
      font-size: 13px;
      line-height: $base-line-height * 0.8;
    }
  }

  a:hover {
    img {
      opacity: 1;
    }

    h3 {
      color: darken($orange, 5%);
    }
  }
}

#front-book {
  float: left;
  width: 590px;
  padding-top: 20px;
  border-top: solid 1px $base-border-color;

  img {
    float: left;
    margin-right: 20px;
  }

  p {
    margin-top: 16px;
  }
}

$monitor-width: 313px;
$monitor-height: 271px;

#front-downloads {
  float: right;
  width: 313px;
  position: relative;

  .monitor {
    position: absolute;
    top: 0;
    right: -12px;
  }

  table {
    position: absolute;
    top: $monitor-height;
    left: 24px;

    td {
      padding: 8px 20px 6px 0;
      min-width: 145px;
    }

    a {
      font-weight: bold;
    }
  }
}

.monitor {
  @include background-image-2x($baseurl + "images/monitor-default", $monitor-width, $monitor-height);
  width: $monitor-width - 40;
  height: $monitor-height - 45;
  padding-top: 45px;
  padding-left: 40px;
  color: #fff;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.2);

  h4 {
    font-weight: normal;
    color: #fff;
    font-size: 16px;
  }

  span.version {
    display: block;
    margin-bottom: 6px;
    font-size: 28px;
    font-weight: bold;
  }

  a {
    color: #eee;
    font-size: 12px;
    text-decoration: underline;
  }

  span.release-date {
    font-size: 12px;
  }

  a.button {
    @include border-radius(2px);
    @include box-shadow(0 1px 0 #148a92);
    display: block;
    width: 224px;
    padding: 5px 0;
    margin-top: 10px;
    font-size: 16px;
    color: #fff;
    text-align: center;
    background-image: linear-gradient(#1c868c, #186368);
    border-top: solid 1px #085e64;
    border-right: solid 1px #1f6367;
    border-bottom: solid 1px #134143;
    border-left: solid 1px #1f6367;
    transition-duration: 0.3s;
    transition-property: background-image;
    text-decoration: none;

    &:hover {
      background-image: linear-gradient(#1a7e84, #165b60);
    }
  }

  &.mac {
    @include background-image-2x($baseurl + "images/monitor-mac", $monitor-width, $monitor-height);
    width: $monitor-width - 40;
    height: $monitor-height - 36;
    padding-top: 36px;
    padding-left: 40px;
  }

  &.windows {
    @include background-image-2x($baseurl + "images/monitor-windows", $monitor-width, $monitor-height);
  }

  &.linux {
    @include background-image-2x($baseurl + "images/monitor-linux", $monitor-width, $monitor-height);
  }
}

#companies-projects {
  padding-top: 20px;
  clear: both;
  border-top: solid 1px $base-border-color;

  ul {
    @extend .unstyled !optional;

    li {
      display: block;
      float: left;
      width: 108px;
      height: 65px;
      margin: 0 4px 25px 5px;
    }

    a {
      display: block;
      width: 108px;
      height: 65px;
      text-indent: -9999px;
      background-repeat: no-repeat;
      background-position: 0 0;
      opacity: 0.85;
      transition-duration: 0.3s;
      transition-property: opacity;

      &:hover {
        opacity: 1;
      }

      &.google {
        @include background-image-2x($baseurl + "images/company-project-logos/google", 108px, 65px);
      }

      &.twitter {
        @include background-image-2x($baseurl + "images/company-project-logos/twitter", 108px, 65px);
      }

      &.microsoft {
        @include background-image-2x($baseurl + "images/company-project-logos/microsoft", 108px, 65px);
      }

      &.netflix {
        @include background-image-2x($baseurl + "images/company-project-logos/netflix", 108px, 65px);
      }

      &.linked-in {
        @include background-image-2x($baseurl + "images/company-project-logos/linked-in", 108px, 65px);
      }

      &.linux {
        @include background-image-2x($baseurl + "images/company-project-logos/linux", 108px, 65px);
      }

      &.perl {
        @include background-image-2x($baseurl + "images/company-project-logos/perl", 108px, 65px);
      }

      &.postgresql {
        @include background-image-2x($baseurl + "images/company-project-logos/postgresql", 108px, 65px);
      }

      &.android {
        @include background-image-2x($baseurl + "images/company-project-logos/android", 108px, 65px);
      }
      &.rails {
        @include background-image-2x($baseurl + "images/company-project-logos/rails", 108px, 65px);
      }

      &.qt {
        @include background-image-2x($baseurl + "images/company-project-logos/qt", 108px, 65px);
      }

      &.gnome {
        @include background-image-2x($baseurl + "images/company-project-logos/gnome", 108px, 65px);
      }

      &.eclipse {
        @include background-image-2x($baseurl + "images/company-project-logos/eclipse", 108px, 65px);
      }

      &.kde {
        @include background-image-2x($baseurl + "images/company-project-logos/kde", 108px, 65px);
      }

      &.x {
        @include background-image-2x($baseurl + "images/company-project-logos/x", 108px, 65px);
      }
    }
  }
}

a.icon {
  display: inline-block;
  height: 30px;
  padding-left: 30px;
  line-height: 36px;

  &.gui {
    @include background-image-2x($baseurl + "images/icons/gui", 18px, 24px, 6px 3px);
  }

  &.older-releases {
    @include background-image-2x($baseurl + "images/icons/box", 22px, 20px, 0 6px);
  }

  &.windows {
    @include background-image-2x($baseurl + "images/icons/windows", 24px, 21px, 0 6px);
  }

  &.mac {
    @include background-image-2x($baseurl + "images/icons/apple", 17px, 21px, 5px 4px);
  }

  &.linux {
    @include background-image-2x($baseurl + "images/icons/linux", 17px, 21px, 6px 6px);
  }

  &.source {
    @include background-image-2x($baseurl + "images/icons/source-code", 25px, 20px, 0 6px);
  }
}



// Breakpoint ----------------
@media (max-width: $default) {
  #front-content {
    display: flex;
    #front-navigation {
      width: 50%;
      #front-nav {
        ul {
          padding: 0 1rem 0 0;
          li {
            margin-bottom: 1rem !important;
            margin-right: 0 !important;
          }
        }
      }
      #front-book {
        width: unset;
      }
    }
    #front-downloads {
      width: 50%;
      .monitor {
        @include center-transformX;
      }
      table{
        @include center-transformX;
        tbody, tr {
          display: flex;
          flex-direction: column;
        }
        td {
          margin-bottom: 1rem;
          a { padding-left: 2.3rem; }
        }
      }
    }
  }
  #companies-projects {
    ul {
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
    }
    li {
      margin: 0.7rem 0.4rem;
    }
  }
}

// Mobile
@media (max-width: $mobile-m) {
  #front-content{
    flex-direction: column-reverse;
    #front-navigation, #front-downloads {
      width: 100%;
      border-right: none;
    }
    #front-navigation {
      #front-nav  {
        ul {
          padding: 0 1rem;
        }
      }
      #front-book {
        @include flex-center;
        align-items: center;
      }
    }
    #front-downloads {
      border-bottom: 1px solid $base-border-color;
      margin-bottom: 2rem;
      padding-bottom: 1rem;
      .monitor, table {
        position: relative;
      }
      table {
        top: 0;
      }
    }
  }
}
